package com.example.demo.common.exception;


import com.example.demo.common.exception.handler.ErrorHandler;

/**
 * 系统基础的异常处理
 */
public class BaseException extends Exception {


    /**
     *
     */
    private static final long serialVersionUID = 1L;

    /**
     * 自定义异常码
     **/
    private String errorCode;

    /**
     * 异常码消息
     **/
    private String errorMsg;

    public BaseException() {
    }

    public BaseException(String errorCode) {
        super(ErrorHandler.getErrMsg(errorCode));
        this.errorCode = errorCode;
        this.errorMsg = ErrorHandler.getErrMsg(errorCode);
    }

    public BaseException(String errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BaseException(Throwable exception) {
        super(exception);
    }

    public BaseException(String errorCode, String errorMsg, Throwable cause) {
        super(errorMsg, cause);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public static long getSerialversionuid() {
        return serialVersionUID;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }


}
 